import request from '@/utils/request'
import {downloadExcel} from "@/api/ApiUtils";

const urlPrefix = "/api/bizRef/";

/**
 * 查询详情
 * @param id
 */
export function getById(id) {
    return request({
        url:  urlPrefix + 'getById?id='+ id ,
        method: 'GET'
    })
}

/**
 * 查询列表
 * @param query
 */
export function queryList(query) {
    return request({
        url:  urlPrefix + 'page',
        method: 'POST',
        data:query
    })
}

/**
 * 导出列表
 * @param query
 */
export function exportList(query) {
    return request.post(
        urlPrefix + 'export',
        query,
        {responseType:"blob"}
    ).then((res)=>{
        downloadExcel(res,"关系表列表.xlsx");
    })
}


/**
 * 保存数据
 * @param type
 */
export function save (data) {
    return request({
        url: urlPrefix + 'save',
        method: 'POST',
        data: data
    })
}

/**
 * 删除数据
 * @param note
 */
export function deleteById (id) {
    if(!id || id <= 0){
        return null;
    }
    return request({
        url: urlPrefix + 'deleteById?id='+ id ,
        method: 'POST'
    })
}
